package caj.springboot.mapper;

import caj.springboot.model.dto.log.LogSearchDTO;
import caj.springboot.model.po.Log;
import caj.springboot.model.vo.LogVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author: CAJ
 * @time: 2023/12/7 16:56
 */
@Mapper
public interface LogMapper extends BaseMapper<Log> {

    /**
     * 判断id是否存在(实际上用selectCount也可以进行这样的操作)
     * @param id
     * @return
     */
    @Select("select EXISTS(select 1 from tbl_log where id = #{id})")
    boolean isLogExistById(@Param("id") Long id);

    /**
     * 这里把serviceImpl中采用selectPage的接口用xml的方式实现一下
     * @param filter 查询参数
     * @return 返回的Page对象
     */
    IPage<Log> getLogPageByXml(@Param("filter") LogSearchDTO filter,IPage<Log> page);
}
